﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RK.FormPlugin.GFT
{
    public class BomDataNode
    {
        // Token: 0x1700000C RID: 12
        // (get) Token: 0x060000CB RID: 203 RVA: 0x0000C6C1 File Offset: 0x0000A8C1
        // (set) Token: 0x060000CC RID: 204 RVA: 0x0000C6E3 File Offset: 0x0000A8E3
        public decimal Numerator
        {
            get
            {
                if (this.numerator > 0m)
                {
                    return this.numerator;
                }
                return 1m;
            }
            set
            {
                this.numerator = value;
            }
        }

        // Token: 0x1700000D RID: 13
        // (get) Token: 0x060000CD RID: 205 RVA: 0x0000C6EC File Offset: 0x0000A8EC
        // (set) Token: 0x060000CE RID: 206 RVA: 0x0000C70E File Offset: 0x0000A90E
        public decimal Denominator
        {
            get
            {
                if (this.denominator > 0m)
                {
                    return this.denominator;
                }
                return 1m;
            }
            set
            {
                this.denominator = value;
            }
        }

        // Token: 0x1700000E RID: 14
        // (get) Token: 0x060000CF RID: 207 RVA: 0x0000C717 File Offset: 0x0000A917
        public decimal Qty
        {
            get
            {
                return this.ConvertToPurUnitQty(this.BaseQty);
            }
        }

        // Token: 0x1700000F RID: 15
        // (get) Token: 0x060000D0 RID: 208 RVA: 0x0000C725 File Offset: 0x0000A925
        public decimal ActualQty
        {
            get
            {
                return this.ConvertToPurUnitQty(this.BaseActualQty);
            }
        }

        // Token: 0x17000010 RID: 16
        // (get) Token: 0x060000D1 RID: 209 RVA: 0x0000C733 File Offset: 0x0000A933
        public decimal ParentActualQty
        {
            get
            {
                if (this.ParentNode != null)
                {
                    return this.ConvertToPurUnitQty(this.ParentNode.ActualQty);
                }
                return this.ConvertToPurUnitQty(this.BaseActualQty);
            }
        }

        // Token: 0x17000011 RID: 17
        // (get) Token: 0x060000D2 RID: 210 RVA: 0x0000C75B File Offset: 0x0000A95B
        public decimal FixScrapQty
        {
            get
            {
                return this.ConvertToPurUnitQty(this.BaseFixScrapQty);
            }
        }

        // Token: 0x060000D3 RID: 211 RVA: 0x0000C76C File Offset: 0x0000A96C
        private decimal ConvertToPurUnitQty(decimal srcQty)
        {
            if (this.BaseUnitId == this.PurchaseUnitId)
            {
                return srcQty;
            }
            if (srcQty == 0m)
            {
                return 0m;
            }
            if (this.PurURNum == 0m)
            {
                this.PurURNum = 1m;
            }
            return srcQty * this.PurURNom / this.PurURNum;
        }

        // Token: 0x17000012 RID: 18
        // (get) Token: 0x060000D4 RID: 212 RVA: 0x0000C7D4 File Offset: 0x0000A9D4
        public bool IsRootNode
        {
            get
            {
                return string.IsNullOrWhiteSpace(this.ParentNodeId);
            }
        }

        // Token: 0x17000013 RID: 19
        // (get) Token: 0x060000D5 RID: 213 RVA: 0x0000C7E1 File Offset: 0x0000A9E1
        public bool IsFinalNode
        {
            get
            {
                return this.ChindrenNodes == null || this.ChindrenNodes.Count <= 0;
            }
        }

        // Token: 0x04000065 RID: 101
        public string Id;

        // Token: 0x04000066 RID: 102
        public BomDataNode ParentNode;

        // Token: 0x04000067 RID: 103
        public string ParentNodeId;

        // Token: 0x04000068 RID: 104
        public long CMaterialId_Id;

        // Token: 0x04000069 RID: 105
        public long MaterialMasterId;

        // Token: 0x0400006A RID: 106
        public long AuxPropId_Id;

        // Token: 0x0400006B RID: 107
        public string MatNumber;

        // Token: 0x0400006C RID: 108
        public string MatName;

        // Token: 0x0400006D RID: 109
        public int SrcSeqNo;

        // Token: 0x0400006E RID: 110
        public DateTime NeedDate;

        // Token: 0x0400006F RID: 111
        public long BaseUnitId;

        // Token: 0x04000070 RID: 112
        public long PurchaseUnitId;

        // Token: 0x04000071 RID: 113
        public long StockUnitId;

        // Token: 0x04000072 RID: 114
        private decimal numerator;

        // Token: 0x04000073 RID: 115
        private decimal denominator;

        // Token: 0x04000074 RID: 116
        public decimal ScrapRate;

        // Token: 0x04000075 RID: 117
        public decimal BaseQty;

        // Token: 0x04000076 RID: 118
        public decimal BaseActualQty;

        // Token: 0x04000077 RID: 119
        public decimal GrossQty;

        // Token: 0x04000078 RID: 120
        public decimal ReqQty;

        // Token: 0x04000079 RID: 121
        public decimal BaseFixScrapQty;

        // Token: 0x0400007A RID: 122
        public decimal ScrapQty;

        // Token: 0x0400007B RID: 123
        public decimal UsefulStockQty;

        // Token: 0x0400007C RID: 124
        public int PurchaseUnitDecimal;

        // Token: 0x0400007D RID: 125
        public decimal SafeStockQty;

        // Token: 0x0400007E RID: 126
        public string ErpClsID = "2";

        // Token: 0x0400007F RID: 127
        public decimal PurURNum;

        // Token: 0x04000080 RID: 128
        public decimal PurURNom;

        // Token: 0x04000081 RID: 129
        public List<BomDataNode> ChindrenNodes = new List<BomDataNode>();

        // Token: 0x04000082 RID: 130
        public bool HasSetRelation;

        // Token: 0x04000083 RID: 131
        public bool IsPurchase;

        // Token: 0x04000084 RID: 132
        public long OMaterialId_Id;
    }
}
